Here I want to talk briefly about the advantages of and tools for building project-oriented workflows. As a beginning R user, I was aware of the benefits of organizing each data analysis into a project: a folder on your computer that holds all the files relevant to that particular piece of work. However, I was unaware of tools such as Rprojects that allowed for easy navigation through projects.
I stumbled across R projects when I was trying (and failing) to keep scripts in separate project directories organized AND accessible on multiple machines.
In my early days I was no stranger to having this at the top of each script:
setwd('path/that/only/ever/works/on/one/machine')
Here, R takes the absolute file path as an input then sets it as the current working directory of the R process. While setwd() served it’s purpose, I often ended up frustrated when trying to change from project A to project B or working on my personal computer. And not to mention the impossibility of easily sharing code with this structure. Simply moving the entire directory to a new sub-folder or to a new drive breaks the links leaving you with a useless script!
RStudio fully supports Project-based workflows, making it easy to switch from one to another, have many projects open at once, re-launch recently used Projects, etc.
Creating a new project is simple and RStudio provides a walkthrough for this.
Here’s a real-time video of how to create a new R Project yourself: